package org.easy.core.enums;

/**
 * @author hyk
 * @date 2019/8/4
 * @Description
 */
public enum FileGroup {

    FILE(1, "文件"),
    IMAGE(2, "图片"),
    VIDEO(3, "视频"),
    AUDIO(4, "音频"),
    ;

    FileGroup(int index, String message) {
        this.index = index;
        this.message = message;
    }

    private final int index;

    private final String message;

    public int getIndex() {
        return index;
    }

    public String getMessage() {
        return message;
    }

    public static boolean isImage(String suffix) {
        FileGroup groupBySuffix = FileType.getGroupBySuffix(suffix);
        if (groupBySuffix == null) {
            return false;
        }
        return groupBySuffix == FileGroup.IMAGE;
    }

    public static boolean isVideo(String suffix) {
        FileGroup groupBySuffix = FileType.getGroupBySuffix(suffix);
        if (groupBySuffix == null) {
            return false;
        }
        return groupBySuffix == FileGroup.VIDEO;
    }

    public static boolean isAudio(String suffix) {
        FileGroup groupBySuffix = FileType.getGroupBySuffix(suffix);
        if (groupBySuffix == null) {
            return false;
        }
        return groupBySuffix == FileGroup.AUDIO;
    }
}
